package com.lzh.redis.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * @author zhehen.lu
 * @date 2025/9/6 11:27
 */
@ConfigurationProperties(prefix = "spring.redisson")
@Configuration
public class RedissonProperties {
    private Boolean enable = false;
    private Integer timeout = 3000;
    private Integer retryAttempts = 3;
    private Integer retryInterval = 1500;

    public RedissonProperties() {
    }

    public Boolean getEnable() {
        return this.enable;
    }

    public Integer getTimeout() {
        return this.timeout;
    }

    public Integer getRetryAttempts() {
        return this.retryAttempts;
    }

    public Integer getRetryInterval() {
        return this.retryInterval;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public void setTimeout(Integer timeout) {
        this.timeout = timeout;
    }

    public void setRetryAttempts(Integer retryAttempts) {
        this.retryAttempts = retryAttempts;
    }

    public void setRetryInterval(Integer retryInterval) {
        this.retryInterval = retryInterval;
    }

    @Override
    public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof RedissonProperties)) {
            return false;
        } else {
            RedissonProperties other = (RedissonProperties)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                label59: {
                    Object this$enable = this.getEnable();
                    Object other$enable = other.getEnable();
                    if (this$enable == null) {
                        if (other$enable == null) {
                            break label59;
                        }
                    } else if (this$enable.equals(other$enable)) {
                        break label59;
                    }

                    return false;
                }

                Object this$timeout = this.getTimeout();
                Object other$timeout = other.getTimeout();
                if (this$timeout == null) {
                    if (other$timeout != null) {
                        return false;
                    }
                } else if (!this$timeout.equals(other$timeout)) {
                    return false;
                }

                Object this$retryAttempts = this.getRetryAttempts();
                Object other$retryAttempts = other.getRetryAttempts();
                if (this$retryAttempts == null) {
                    if (other$retryAttempts != null) {
                        return false;
                    }
                } else if (!this$retryAttempts.equals(other$retryAttempts)) {
                    return false;
                }

                Object this$retryInterval = this.getRetryInterval();
                Object other$retryInterval = other.getRetryInterval();
                if (this$retryInterval == null) {
                    if (other$retryInterval != null) {
                        return false;
                    }
                } else if (!this$retryInterval.equals(other$retryInterval)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(Object other) {
        return other instanceof RedissonProperties;
    }

    @Override
    public int hashCode() {
        boolean PRIME = true;
        int result1 = 1;
        Object $enable = this.getEnable();
        int result = result1 * 59 + ($enable == null ? 43 : $enable.hashCode());
        Object $timeout = this.getTimeout();
        result = result * 59 + ($timeout == null ? 43 : $timeout.hashCode());
        Object $retryAttempts = this.getRetryAttempts();
        result = result * 59 + ($retryAttempts == null ? 43 : $retryAttempts.hashCode());
        Object $retryInterval = this.getRetryInterval();
        result = result * 59 + ($retryInterval == null ? 43 : $retryInterval.hashCode());
        return result;
    }

    @Override
    public String toString() {
        return "RedissonProperties(enable=" + this.getEnable() + ", timeout=" + this.getTimeout() + ", retryAttempts=" + this.getRetryAttempts() + ", retryInterval=" + this.getRetryInterval() + ")";
    }
}
